<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
// 
//  user_model.php
//  www.6block.com
//  
//  Created by Will_Lee on 2011-05-21.
//  Copyright 2011 lishuzu. All rights reserved.
// 


class User_model extends CI_Model
{
		function __construct(){
			parent::__construct();
			$this->load->library('pagination');
			$this->load->model('Activity_model');
		}
		
		function get_user($uid){
			if ($uid) {
				$this->db->where('uid', $uid);
				$query = $this->db->get('user');
				$data = $query->row_array();
				return $data;
			}
			return false;
		}
		
		function insert_user($data){
			if ($data) {
				$this->db->insert('user', $data);
				return $this->db->insert_id();
			}
			return false;
		}
		
		function get_user_by_where($where){
			if (is_array($where)) {
				$this->db->where('uid', $uid);
				$query = $this->db->get('user');
				$data = $query->row_array();
				return $data;
			}
			return false;
		}
		
		function update_userinfo_by_uid($uid, $data){
			if ($uid) {
				$wheresql = array('uid' => $uid);
				$this->db->where($wheresql);
				$this->db->update('user', $data);
				return true;
			}
			return false;
		}
}
?>